{
  Copyright 2012 Sergey Ostanin

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
}

unit About;

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
  StdCtrls, VisualUtils, DetailedAbout;

type
  TAboutForm = class(TForm)
    btnClose: TButton;
    btnDetails: TButton;
    gbxMain: TGroupBox;
    imgIcon: TImage;
    lblSite: TLabel;
    lblCopyright: TLabel;
    lblVersion: TLabel;
    lblSubheading: TLabel;
    lblTitle: TLabel;
    pnlRight: TPanel;
    pnlCenter: TPanel;
    pnlButtons: TPanel;
    procedure btnDetailsClick(Sender: TObject);
    procedure lblSiteClick(Sender: TObject);
  private
    procedure Prepare;
    { private declarations }
  public
    class procedure OpenModal;
    { public declarations }
  end;

implementation

{$R *.lfm}
{$R *.rc}

const
  PROGRAM_VERSION = '0.2012.09pre';

{ TAboutForm }

procedure TAboutForm.lblSiteClick(Sender: TObject);
begin
  OpenWithShell(lblSite.Caption);
end;

procedure TAboutForm.btnDetailsClick(Sender: TObject);
begin
  TDetailedAboutForm.OpenModal('About/NOTICE');
end;

procedure TAboutForm.Prepare;
begin
  LoadPngResourceToPicture('About/icon.png', imgIcon.Picture);
  lblVersion.Caption := lblVersion.Caption + ' ' + PROGRAM_VERSION;
  gbxMain.Font.Size := 10;
  lblTitle.Font.Size := 28;
  lblSite.Font.Color := clHotLight;
  lblSite.Font.Style := [fsUnderline];
  pnlRight.BorderSpacing.Left := ScalePixels(50);
end;

class procedure TAboutForm.OpenModal;
var
  Form: TAboutForm;
begin
  Form := TAboutForm.Create(nil);
  try
    RestoreFormPosition(Form);
    Form.Prepare;
    ShowModalForm(Form);
  finally
    Form.Free;
  end;
end;

end.

